package cz.muni.fi.pa036is.dtoconverters;

import cz.muni.fi.pa036is.dto.ComplaintDetailTO;
import cz.muni.fi.pa036is.dto.ComplaintFormTO;
import cz.muni.fi.pa036is.dto.ComplaintGridTO;
import cz.muni.fi.pa036is.entity.Complaint;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Shebik
 */
public class ComplaintConverter {

    public static Complaint convertToComplaint(final ComplaintFormTO complaintFormTO) {
        final Complaint complaint = new Complaint();
        complaint.setId(complaintFormTO.getId());
        complaint.setMatchId(complaintFormTO.getMatchId());
        complaint.setName(complaintFormTO.getName());
        complaint.setText(complaintFormTO.getText());
        complaint.setStatus(complaintFormTO.getStatus());
        return complaint;
    }

    public static ComplaintDetailTO convertToComplaintDetailTO(
            final Complaint complaint) {
        final ComplaintDetailTO complaintDetailTO = new ComplaintDetailTO();
        complaintDetailTO.setId(complaint.getId());
        complaintDetailTO.setMatchId(complaint.getMatchId());
        complaintDetailTO.setName(complaint.getName());
        complaintDetailTO.setText(complaint.getText());
        complaintDetailTO.setStatus(complaint.getStatus());
        return complaintDetailTO;
    }
				
				public static ComplaintFormTO convertToComplaintFormTO(
            final Complaint complaint) {
        final ComplaintFormTO complaintFormTO = new ComplaintFormTO();
        complaintFormTO.setId(complaint.getId());
        complaintFormTO.setMatchId(complaint.getMatchId());
        complaintFormTO.setName(complaint.getName());
        complaintFormTO.setText(complaint.getText());
        complaintFormTO.setStatus(complaint.getStatus());
        return complaintFormTO;
    }

    public static ComplaintGridTO convertToComplaintGridTO(
            final Complaint complaint) {
        final ComplaintGridTO complaintGridTO = new ComplaintGridTO();
        complaintGridTO.setId(complaint.getId());
        complaintGridTO.setMatchId(complaint.getMatchId());
        complaintGridTO.setName(complaint.getName());
        complaintGridTO.setText(complaint.getText());
        complaintGridTO.setStatus(complaint.getStatus());
        return complaintGridTO;
    }

    public static List<ComplaintGridTO> convertToComplaintGridTOList(
            final List<Complaint> complaintList) {
        final List<ComplaintGridTO> complaintGridTOList =
                new ArrayList<ComplaintGridTO>();

        for (final Complaint complaint : complaintList) {
            complaintGridTOList.add(convertToComplaintGridTO(complaint));
        }
        return complaintGridTOList;
    }


}
